package com.example.x1c.androidthreadtest;

import android.app.ProgressDialog;
import android.os.AsyncTask;

/**
 * Created by x1c on 2017/12/31.
 */

public class DownloadTask extends AsyncTask<Void, Integer, Boolean> {

    ProgressDialog progressDialog;

    @Override
    protected void onPreExecute() {
        progressDialog.show();
    }

    @Override
    protected void onPostExecute(Boolean aBoolean) {
        super.onPostExecute(aBoolean);
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        super.onProgressUpdate(values);
        progressDialog.setMessage("Downloaded " + values[0] +"%");
    }

    @Override
    protected void onCancelled(Boolean aBoolean) {
        super.onCancelled(aBoolean);
    }

    @Override
    protected void onCancelled() {
        super.onCancelled();
    }

    @Override
    protected Boolean doInBackground(Void... voids) {
        publishProgress();
        return null;
    }
}
